#pragma once

#include "map.h"


#include <conio.h>//for getch,

#include <time.h>
#include <windows.h> //clock
#include "cli.h" //goto n color  color, defines
//Main class
class Game
{
private:
	char m_cursor;
	int m_tokenXPos, m_tokenYPos; //tokens current X and Y position
	int m_tokenOldX, m_tokenOldY; //tokens previous X and Y position
	int m_tokenWidth, m_tokenHeight; //tokens size
	bool m_whitesTurn; //variable to check if its the whites tokens turn
	char m_currentToken; //is the character the token is ex. 'W'
	char m_enemyToken; //to show how the enemy is
	//used in bool right,left,up,down, and diagonals checkes to get the position of when to stop
	//changing/fliping the tokens.
	int m_checkedXPos;
	int m_checkedYPos;
	/*int m_timer, m_updateSpeed;*/
	bool m_changeTurn;

	char ** m_gameMap;
	int m_mapWidth, m_mapHeight;
	int m_mapXPos, m_mapYPos;
	Map mapClass;
	int m_endGame;

	int m_bScore, m_wScore, m_addTok;
public:
	void gameInit();
	void readGameMap( Map & a);

	void drawMap();
	void changeTurns();
	void drawCursor();
	void draw();
	void releaseMap();

	void handleInput(char a_input);
	int getMoveUp(int a_y);
	int getMoveDown(int a_y);
	int getMoveRight(int a_x);
	int getMoveLeft(int a_x);
	
	void collisionCheck();
	bool overlaps(char a_value, int a_x, int a_y);
	void addToken();
	void flipTokenLogic();

	bool rightCheck();
	bool leftCheck();
	bool upCheck();
	bool downCheck();
	bool RUCheck();
	bool RDCheck();
	bool LUCheck();
	bool LDCheck();
	void countScore();
	void endCondition();
	void update(/*int a_ms*/);
};
